<template>
	<view class="">
		<view class="product">
			<view 
			v-for="(item,index) in productList" 
			@tap ="toproductdetail(item.id)"
			:key="index" class="productist">
			    <view v-if="item.tags_name" class="sc-tour-li-tags" ><text>{{item.tags_name}}</text></view>
				<image class="itemImg" :src="item.cover" mode="aspectFill"></image>
				<view class="productist-padd">
					<view class="productist_title">
						{{item.name}}
					</view>
					<!-- <view class="productist_desc">
						{{item.brief}}
					</view> -->
					<view class="volume volume-font"><image :src="Url+'add_images/ic-hot.png'" mode="widthFix"></image>销量:{{item.show_sales}}</view>
					<view class="clearfix price-bottom">
						<view class="price ">
							{{item.price}} <text v-if="item.cost_price">￥{{item.cost_price}}</text>
						</view>
						<view class="addcart">
							<image :src="Url+'add_images/ic-add.png'" mode=""></image>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: ['productList'],
		data () {
			return {
				Url:this.Imgurl
			}
		},
		methods: {
			toproductdetail (item) {
				this.$emit('toproductdetail',item)
			}
		}
	}
</script>

<style lang="less" scoped>
	.productist-padd{
		padding: 0 25upx 25upx;
	}
	.volume {
		font-size: 20upx;
		color: #999;
		margin: 10upx 0 25upx 0;
	}
	.volume-font{
		padding: 8upx 17upx;
		box-sizing: border-box;
		background:rgba(255,40,66,0.04);
		width: auto;
		height: auto;
		float: left;
		border-radius:4upx;
		color: #FF2842;
		display: flex;
		align-items: center;
		justify-content: center;
		image{
			width:25upx;
			height: 25upx;
			margin-right:10upx;
		}
	}
	.product {
		display: flex;
		padding: 0 20upx;
		box-sizing: border-box;
		justify-content: space-between;
		flex-wrap: wrap;
		padding-bottom: 20upx;
		box-sizing: border-box;
	}
	.productist {
		position: relative;
		width:48.5%;
		background-color: #FFFFFF;
		border-radius: 10upx;
		margin-top: 20upx;
		box-sizing: border-box;
		.sc-tour-li-tags{
			position: absolute;
			top: 0;
			left:5%;
			width: 65upx;
			height: 64upx;
			font-size:18upx;
			padding: 0 10upx;
			box-sizing: border-box;
			color: #FFFFFF;
			word-wrap: break-word;
			word-break: break-all;
			text-align: center;
			background-image: url('https://jy-shops.oss-cn-beijing.aliyuncs.com/client/image/add_images/sc-tags.png');
			background-size: cover;
			z-index: 10;
			transform-origin: 0 0;
			display: flex;
			align-items: center;
			justify-content: center;
			flex-wrap: wrap;
			text{
				transform: scale(0.8,0.8);
				line-height: 1.3;
			}
		}
		.itemImg {
			width: 100%;
			height: 322upx;
			border-top-right-radius: 10upx;
			border-top-left-radius: 10upx;
		}
		.productist_title {
			font-size: 24upx;
			color: #333333;
			line-height: 40upx;
			overflow: hidden;/*超出部分隐藏*/
			white-space: nowrap;/*不换行*/
			text-overflow:ellipsis;/*超出部分文字以...显示*/
		}
		.productist_desc {
			font-size: 24upx;
			color: #999999;
			height: 32upx;
			margin: 10upx 0;
			overflow: hidden;/*超出部分隐藏*/
			white-space: nowrap;/*不换行*/
			text-overflow:ellipsis;/*超出部分文字以...显示*/
		}
		.price-bottom{
			display: flex;
			align-items: center;
			justify-content: space-between;
		}
		.price {
			// margin-top: 30upx;
			font-size: 28upx;
			color: #f73e2f;
			font-weight: bold;
			text {
				font-size: 18upx;
				color: #999999;
				text-decoration: line-through;
				margin-left: 10upx;
				font-weight: 500;
			}
			&::before{
				content: '￥';
				display: inline-block;
				font-size: 20upx;
				font-weight: 500;
			}
		}
		.addcart {
			width: 44upx;
			height: 44upx;
			image {
				width: 100%;
				height: 100%;
			}
		}
	}
	
</style>
